#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main_39_1()
{
    vector<int> A;
    A.push_back(0);
    int n,N,Ai,sum_A=0;
    scanf("%d%d",&n,&N);
    for (int i=1;i<=n ;i++ )
    {
        scanf("%d",&Ai);
        A.push_back(Ai);
    }
    for (int i=0;i<N ;i++ )
    {
        sum_A+=upper_bound(A.begin(),A.end(),i)-A.begin()-1;
    }
    printf("%d",sum_A);
	return 0;
}
